<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var phone={//创建对象
            name:'华为手机',
            price:1000,
            makeCall:function(){
                console.log('打电话');
            },
            answerPhone:function(){
                console.log('接电话');
            }
        }
        console.log(phone.name);
        console.log(phone['name']);
        phone.makeCall();//执行
        phone['answerPhone']();//方法的调用

        function Animal(name,age){
            this.name=name;
            this.age=age;
            this.show=function(){
                console.log(this.name,this.age,"动物");
            }
        }

        var animal = new Animal('狮子',5);//创建对象
        console.log(animal.name,animal.age);
        animal.show();

        //for(let key  in  phone){
            //console.log(typeof key);//String类型
        //    console.log(key,phone[key]);
        //}
        //'name' in phone//判断属性

        //Animal.prototype.weight = 190;//原形对象

        //Animal.prototype = phone;

        var animal2 = new Animal('大象',10);
        animal2.constructor
        animal2._proto_
    </script>
</body>
</html>